package com.thornbird.vehiclerecycling.model.record;

import com.thornbird.vehiclerecycling.entity.Order;
import com.thornbird.vehiclerecycling.entity.User;
import com.thornbird.vehiclerecycling.model.record.property.RecordProperties;
import com.thornbird.vehiclerecycling.repository.UserRepository;

import java.util.Date;

public class OrderRecord extends Record<Order> {

    private String serialNumber;

    private String certificateNumber;

    private String companyName;

    private String ownerName;

    private String idNumber;

    private String phoneNumber;

    private String address;

    private Date deliveryDate;

    private Date registrationDate;

    private String vehicleNumber;

    private String vehicleType;

    private String vehicleNature;

    private String vehicleBrand;

    private String vehicleModel;

    private String vin;

    private Integer weight;

    private String powerType;

    private String engineNumber;

    private String batteryNumber;

    private String operator;

    private Date processingDate;

    private String remark;

    private Date cancellationDate;

    private String vehicleManagementOffice;

    private String recoveredMaterials;

    private String unrevokedMaterials;

    private String checkCode;

    private Boolean deleted;

    private Long userId;

    private UserRecord user;

    private String checkUrl;

    public String getSerialNumber() {
        return serialNumber;
    }

    public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }

    public String getCertificateNumber() {
        return certificateNumber;
    }

    public void setCertificateNumber(String certificateNumber) {
        this.certificateNumber = certificateNumber;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getOwnerName() {
        return ownerName;
    }

    public void setOwnerName(String ownerName) {
        this.ownerName = ownerName;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Date getDeliveryDate() {
        return deliveryDate;
    }

    public void setDeliveryDate(Date deliveryDate) {
        this.deliveryDate = deliveryDate;
    }

    public Date getRegistrationDate() {
        return registrationDate;
    }

    public void setRegistrationDate(Date registrationDate) {
        this.registrationDate = registrationDate;
    }

    public String getVehicleNumber() {
        return vehicleNumber;
    }

    public void setVehicleNumber(String vehicleNumber) {
        this.vehicleNumber = vehicleNumber;
    }

    public String getVehicleType() {
        return vehicleType;
    }

    public void setVehicleType(String vehicleType) {
        this.vehicleType = vehicleType;
    }

    public String getVehicleNature() {
        return vehicleNature;
    }

    public void setVehicleNature(String vehicleNature) {
        this.vehicleNature = vehicleNature;
    }

    public String getVehicleBrand() {
        return vehicleBrand;
    }

    public void setVehicleBrand(String vehicleBrand) {
        this.vehicleBrand = vehicleBrand;
    }

    public String getVehicleModel() {
        return vehicleModel;
    }

    public void setVehicleModel(String vehicleModel) {
        this.vehicleModel = vehicleModel;
    }

    public String getVin() {
        return vin;
    }

    public void setVin(String vin) {
        this.vin = vin;
    }

    public Integer getWeight() {
        return weight;
    }

    public void setWeight(Integer weight) {
        this.weight = weight;
    }

    public String getPowerType() {
        return powerType;
    }

    public void setPowerType(String powerType) {
        this.powerType = powerType;
    }

    public String getEngineNumber() {
        return engineNumber;
    }

    public void setEngineNumber(String engineNumber) {
        this.engineNumber = engineNumber;
    }

    public String getBatteryNumber() {
        return batteryNumber;
    }

    public void setBatteryNumber(String batteryNumber) {
        this.batteryNumber = batteryNumber;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public Date getProcessingDate() {
        return processingDate;
    }

    public void setProcessingDate(Date processingDate) {
        this.processingDate = processingDate;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCancellationDate() {
        return cancellationDate;
    }

    public void setCancellationDate(Date cancellationDate) {
        this.cancellationDate = cancellationDate;
    }

    public String getVehicleManagementOffice() {
        return vehicleManagementOffice;
    }

    public void setVehicleManagementOffice(String vehicleManagementOffice) {
        this.vehicleManagementOffice = vehicleManagementOffice;
    }

    public String getRecoveredMaterials() {
        return recoveredMaterials;
    }

    public void setRecoveredMaterials(String recoveredMaterials) {
        this.recoveredMaterials = recoveredMaterials;
    }

    public String getUnrevokedMaterials() {
        return unrevokedMaterials;
    }

    public void setUnrevokedMaterials(String unrevokedMaterials) {
        this.unrevokedMaterials = unrevokedMaterials;
    }

    public String getCheckCode() {
        return checkCode;
    }

    public void setCheckCode(String checkCode) {
        this.checkCode = checkCode;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public UserRecord getUser() {
        return user;
    }

    public void setUser(UserRecord user) {
        this.user = user;
    }

    public String getCheckUrl() {
        return checkUrl;
    }

    public void setCheckUrl(String checkUrl) {
        this.checkUrl = checkUrl;
    }

    @Override
    public void parseEntity(Order entity, RecordProperties properties, UserRepository userRepository) {
        super.parseEntity(entity, properties, userRepository);
        User user = userRepository.findFirstById(userId);
        if (user != null) {
            UserRecord userRecord = new UserRecord();
            userRecord.parseEntity(user);
            setUser(userRecord);
        }
    }

}
